package com.loan.web;

import com.loan.dal.entity.InCustomerDO;
import com.loan.service.InCustomerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletResponse;

/**
 * 注册页面
 */

@Controller
@RequestMapping("/cont")
@Slf4j
public class ContinentController {
    @Autowired
    private InCustomerService inCustomerService;
    /**
     * 大地贷款基本信息采集页
     * @return
     */
    @RequestMapping("/reg")
    String registry() {
        return "page/continent/registry";
    }

    /**
     * 可以通过@PathVariable("") 注解将占位符中的值绑定到方法参数上
     * 大地贷款详细信息采集页
     * @return
     */
    @RequestMapping("/regdetail/{userId}")
    String registryDetail(@PathVariable(value = "userId") Integer userId){
      log.debug("id------> {}",userId);
      InCustomerDO inCustomerDO= inCustomerService.queryById(userId);
      if(inCustomerDO==null){
          return "redirect:/cont/reg";
      }
        return "page/continent/registrydetail";
    }

    @RequestMapping("/common")
    String regCom(){

        return "page/continent/common";
    }

}